import { defineStore } from 'pinia'
import store from '@/store' 

export interface deviceInfo {
    isInit: boolean
    deviceId?:string
    writeServiceId?:string
    writeCharaterId?:string
}

export interface printData {

}

const deviceData:deviceInfo = { isInit: false }

export const useBluetoothStore = defineStore("bluetoothStore", {
    state: () => ({
        device: deviceData,
    }),
    getters: {
        isConnect(state) {
            return state.device !== null
        }
    },
    actions: {
        checkConnect() {

        },
        setDevice(device: any) {
            this.device = device
        }

    }
})

export const getBluetoothStore = () => {
    return useBluetoothStore(store)
}